package com.binest.meetingInclusionMain.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.binest.common.annotation.Log;
import com.binest.common.core.controller.BaseController;
import com.binest.common.core.domain.AjaxResult;
import com.binest.common.enums.BusinessType;
import com.binest.meetingInclusionMain.domain.MeetingInclusionMain;
import com.binest.meetingInclusionMain.service.IMeetingInclusionMainService;
import com.binest.common.utils.poi.ExcelUtil;
import com.binest.common.core.page.TableDataInfo;

/**
 * 会议收录主Controller
 * 
 * @author wwd
 * @date 2024-01-03
 */
@RestController
@RequestMapping("/meetingInclusionMain")
public class MeetingInclusionMainController extends BaseController
{
    @Autowired
    private IMeetingInclusionMainService meetingInclusionMainService;

    /**
     * 查询会议收录主列表
     */
//    @PreAuthorize("@ss.hasPermi('meetingInclusionMain:meetingInclusionMain:list')")
    @GetMapping("/list")
    public TableDataInfo list(MeetingInclusionMain meetingInclusionMain)
    {
        startPage();
        List<MeetingInclusionMain> list = meetingInclusionMainService.selectMeetingInclusionMainList(meetingInclusionMain);
        return getDataTable(list);
    }

    /**
     * 导出会议收录主列表
     */
    @PreAuthorize("@ss.hasPermi('meetingInclusionMain:meetingInclusionMain:export')")
    @Log(title = "会议收录主", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MeetingInclusionMain meetingInclusionMain)
    {
        List<MeetingInclusionMain> list = meetingInclusionMainService.selectMeetingInclusionMainList(meetingInclusionMain);
        ExcelUtil<MeetingInclusionMain> util = new ExcelUtil<MeetingInclusionMain>(MeetingInclusionMain.class);
        util.exportExcel(response, list, "会议收录主数据");
    }

    /**
     * 获取会议收录主详细信息
     */
    @PreAuthorize("@ss.hasPermi('meetingInclusionMain:meetingInclusionMain:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(meetingInclusionMainService.selectMeetingInclusionMainById(id));
    }

    /**
     * 新增会议收录主
     */
    @PreAuthorize("@ss.hasPermi('meetingInclusionMain:meetingInclusionMain:add')")
    @Log(title = "会议收录主", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MeetingInclusionMain meetingInclusionMain)
    {
        return toAjax(meetingInclusionMainService.insertMeetingInclusionMain(meetingInclusionMain));
    }

    /**
     * 修改会议收录主
     */
    @PreAuthorize("@ss.hasPermi('meetingInclusionMain:meetingInclusionMain:edit')")
    @Log(title = "会议收录主", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MeetingInclusionMain meetingInclusionMain)
    {
        return toAjax(meetingInclusionMainService.updateMeetingInclusionMain(meetingInclusionMain));
    }

    /**
     * 删除会议收录主
     */
    @PreAuthorize("@ss.hasPermi('meetingInclusionMain:meetingInclusionMain:remove')")
    @Log(title = "会议收录主", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(meetingInclusionMainService.deleteMeetingInclusionMainByIds(ids));
    }
}
